package org.ali.structuralpattern.filterpattern.filter;

import org.ali.structuralpattern.filterpattern.Graph;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 过滤器
 */
public class FilterRed implements Filter {
    @Override
    public List<Graph> filter(List<Graph> graphs) {
        List<Graph> redGraphs = new ArrayList<>();
        for (Graph graph : graphs) {
            if (Objects.equals("Red", graph.getColor())) {
                redGraphs.add(graph);
            }
        }
        return redGraphs;
    }
}
